package cn.com.gaobb.controller;

import cn.com.gaobb.dto.ResultDTO;
import cn.com.gaobb.service.ClientService;
import cn.com.gaobb.vo.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author haopt
 * @version 1.0
 * @ClassName ClientController
 * @Description TODO
 * @date 2021/4/2 10:32
 */
@RestController
@RequestMapping("/api/client")
public class ClientController {
    @Autowired
    private ClientService clientService;

    @PostMapping("/add")
    public ResultDTO<ResIdVO> add(@RequestBody ReqClientAddVO reqVO) {
        return clientService.add(reqVO);
    }

    @PostMapping("/update")
    public ResultDTO update(@RequestBody ReqClientUpdateVO vo) {
        return clientService.update(vo);
    }

    @PostMapping("/deleteList")
    public ResultDTO deleteList(@RequestBody ReqClientDeleteListVO vo) {
        return clientService.deleteList(vo);
    }

    @GetMapping("/detail")
    public ResultDTO<ResClientDetailVO> detail(@RequestParam("id")String id) {
        return clientService.detail(id);
    }

    @PostMapping("/listOfPage")
    public ResultDTO<ResPageVO<ResClientDetailVO>> listOfPage(@RequestBody ReqPageVO vo) {
        return clientService.listOfPage(vo);
    }

    @GetMapping("/list")
    public ResultDTO<List<ResClientDetailVO>> list() {
        return clientService.list();
    }
}
